package com.tecode.service.songsheet;

import com.tecode.bean.MusicSongsheet;
import com.tecode.bean.Songsheet;
import com.tecode.mapper.MusicMapper;
import com.tecode.mapper.MusicSongsheetMapper;
import com.tecode.mapper.SongsheetMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class SongSheetServiceImp implements SongSheetService {
    @Autowired
    private SongsheetMapper songsheetMapper;
    @Autowired
    private MusicMapper musicMapper;
    @Autowired
    private MusicSongsheetMapper musicSongsheetMapper;

    @Override
    public int deleteByPrimaryKey(Integer songsheetid) {
        return songsheetMapper.deleteByPrimaryKey(songsheetid);
    }

    @Override
    public int insert(Songsheet record) {
        return songsheetMapper.insert(record);
    }

    @Override
    public int insertSelective(Songsheet record) {
        return songsheetMapper.insertSelective(record);
    }

    @Override
    public Songsheet selectByPrimaryKey(Integer songsheetid) {
        return songsheetMapper.selectByPrimaryKey(songsheetid);
    }

    @Override
    public int updateByPrimaryKeySelective(Songsheet record) {
        return songsheetMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Songsheet record) {
        return songsheetMapper.updateByPrimaryKey(record);
    }

    @Override
    public List songsheetOrderByTrafficVolume() {
        return songsheetMapper.songsheetOrderByTrafficVolume();
    }

    @Override
    public List songsheetOrderByCollectionVolume() {
        return songsheetMapper.songsheetOrderByCollectionVolume();
    }

    @Override
    public List songsheetOrderByCreatetime() {
        return songsheetMapper.songsheetOrderByCreatetime();
    }

    @Override
    public List selectBySongsheetName(String songsheetName) {
        return songsheetMapper.selectBySongsheetName(songsheetName);
    }

    @Override
    public Integer countSelectBySongsheetName(String songsheetName) {
        return songsheetMapper.countSelectBySongsheetName(songsheetName);
    }

    @Override
    public List selectByUserNickname(String nickname) {
        return songsheetMapper.selectByUserNickname(nickname);
    }

    @Override
    public List selectMusicBySongSheetId(Integer songSheetId) {
        return songsheetMapper.selectMusicBySongSheetId(songSheetId);
    }

    @Override
    public Integer songSheetCount() {
        return songsheetMapper.songSheetCount();
    }

    @Override
    public Integer musicCountBySongSheetId(Integer songSheetId) {
        return songsheetMapper.musicCountBySongSheetId(songSheetId);
    }

    @Override
    public Map<String, Object> selectById(Integer id) {
        return songsheetMapper.selectById(id);
    }

    @Override
    public List<Object> search(String searchName, String searchNickName) {
        return songsheetMapper.search(searchName,searchNickName);
    }

    @Override
    public Integer countSeach(String searchName, String searchNickName) {
        return songsheetMapper.countSeach(searchName,searchNickName);
    }

    @Override
    public List getSongSheetTypes(Integer userId,Integer page) {
        return songsheetMapper.getSongSheetTypes(userId,(page-1)*8,8);
    }

    @Override
    public int saveSongSheet(Songsheet songsheet) {
        return songsheetMapper.saveSongSheet(songsheet);
    }

    @Override
    public List getSongSheetSongsBySongSheetId(Integer songSheetId,Integer page) {
        return musicMapper.getSongSheetSongsBySongSheetId(songSheetId,page);
    }

    @Override
    public int removeMusicSongSheet(MusicSongsheet musicSongsheet) {
        return musicSongsheetMapper.removeMusicSongSheet(musicSongsheet);
    }
}
